/**
 * 
 */
package weibo4j.examples;

import java.util.List;

import weibo4j.Search;
import weibo4j.Trend;
import weibo4j.Users;
import weibo4j.examples.oauth2.Log;
import weibo4j.http.HttpClient;
import weibo4j.model.PostParameter;
import weibo4j.model.Trends;
import weibo4j.model.WeiboException;
import weibo4j.org.json.JSONArray;
import weibo4j.org.json.JSONObject;
import weibo4j.util.WeiboConfig;

/**
 * 注册
 * @author Administrator
 * 
 */
public class WeiboTopic {
	
	//返回最近一小时内的热门话题 
	public static List hourly(String access_token){
		Trend tm = new Trend();
		tm.client.setToken(access_token);
		List<Trends> trends = null;
		try {
			trends = tm.getTrendsHourly();
			for(Trends ts : trends){
				Log.logInfo(ts.toString());
			}
		} catch (WeiboException e) {
			e.printStackTrace();
		}
		return trends;
	}
	//返回最近一天内的热门话题 
	public static List daily(String access_token){
		Trend tm = new Trend();
		tm.client.setToken(access_token);
		List<Trends> trends = null;
		try {
			trends = tm.getTrendsDaily();
			for(Trends ts : trends){
				Log.logInfo(ts.toString());
			}
		} catch (WeiboException e) {
			e.printStackTrace();
		}
		return trends;
	}
	//返回最近一周内的热门话题 
	public static List weekly(String access_token){
		Trend tm = new Trend();
		tm.client.setToken(access_token);
		List<Trends> trends = null;
		try {
			trends = tm.getTrendsWeekly();
			for(Trends ts : trends){
				Log.logInfo(ts.toString());
			}
		} catch (WeiboException e) {
			e.printStackTrace();
		}
		return trends;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String access_token = WeiboContants.access_token;
		String uid =WeiboContants.uid;
		String domain =WeiboContants.domain;
		hourly(access_token);
		daily(access_token);
		weekly(access_token);
	}

}
